package com.BookmanageSystem.service.impl;

import com.BookmanageSystem.dao.BookDao;
import com.BookmanageSystem.entity.Book;
import com.BookmanageSystem.entity.BookType;
import com.BookmanageSystem.service.BookService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class BookServiceImpl implements BookService {

    @Resource
    BookDao bookDao;

    @Override
    public List<Book> getBookList() {
        List<Book> bookList=bookDao.getBookList();
        return bookList;
    }

    @Override
    public List<BookType> getTypeList() {
        return bookDao.getTypeList();
    }

    @Override
    public List<Book> getBookListByName(String bookName) {
        List<Book> bookList = bookDao.getBookListByName(bookName);
        return bookList;
    }

    @Override
    public String deleteBookById(String bookId) {
        return (bookDao.deleteBookById(bookId)).toString();
    }

    @Override
    public Book getBookById(String bookId) {
        return bookDao.getBookById(bookId);
    }

    @Override
    public Integer updateBook(Book book) {
        return bookDao.updateBook(book);
    }

    @Override
    public Integer updateType(BookType type) {
        return bookDao.updateType(type);
    }

    @Override
    public Integer addBook(Book book) {
        return bookDao.addBook(book);
    }

    @Override
    public List<BookType> getTypeListByName(String typeName) {
        return bookDao.getTypeListByName(typeName);
    }

    @Override
    public Integer addType(String typeName) {
        return bookDao.addType(typeName);
    }

    @Override
    public Integer deleteTypeById(String typeId) {
        return bookDao.deleteTypeById(typeId);
    }

    @Override
    public BookType getTypeById(String typeId) {
        return bookDao.getTypeById(typeId);
    }

    @Override
    public Integer outBook(Book book) {
        return bookDao.outBook(book);
    }

    @Override
    public Integer inBook(String bookId) {
        return bookDao.inBook(bookId);
    }


}
